package org.cuatrovientos.hotel.baelish.dani;

import java.util.Scanner;


/**
 * class show menu
 * @author daniel_ancin
 *
 */
public class App 
{
    public static void main( String[] args ) {
    	Scanner scaner = new Scanner(System.in);
    	String line = "";
    	int option = 0;
    	Hotel hotel = new Hotel();
    	
        System.out.println( "Hello Hotel Baelish!" );
        do {
        	System.out.println("1. Add guest");
        	System.out.println("2. Delete guest");
        	System.out.println("3. Search guest");
        	System.out.println("4. Show guests");
        	System.out.println("5. Exit");
        	line = scaner.nextLine();
        	option = Integer.parseInt(line);
            selectOption(scaner, option, hotel);
        } while (option != 5);
    }
    
    
    
/**
 * Extract method
 * @param scaner
 * @param option
 * @param hotel
 */
	private static void selectOption(Scanner scaner, int option, Hotel hotel) {
		String name;
		String room;
		switch (option) {
			case 1 : 
				     System.out.println("Enter name:");
					 name = scaner.nextLine();
					 System.out.println("Enter room:");
					 room = scaner.nextLine();
					 hotel.addGuest(name, room);
					 break;
			case 2 : 
					 System.out.println("Enter name:");
			 		 name = scaner.nextLine();
			 		 hotel.delGuest(name);
					 break;
			case 3 : 
					 System.out.println("Enter name:");
			 		 name = scaner.nextLine();
			 		 System.out.println(hotel.searchGuest(name));
					 break;
			case 4 :
					 System.out.println(hotel.showAll());
					 break;
			default:
					 break;
		}
	}
}
	
	
	

